/**
 * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.gravitee.am.gateway.handler.root.resources.auth.handler;

import io.gravitee.am.gateway.handler.root.resources.auth.handler.impl.FormLoginHandlerImpl;
import io.vertx.ext.auth.AuthProvider;

/**
 * @author Titouan COMPIEGNE (titouan.compiegne at graviteesource.com)
 * @author GraviteeSource Team
 */
public interface FormLoginHandler {

    /**
     * The default value of the form attribute which will contain the username
     */
    String DEFAULT_USERNAME_PARAM = "username";

    /**
     * The default value of the form attribute which will contain the password
     */
    String DEFAULT_PASSWORD_PARAM = "password";

    /**
     * The default value of the form attribute which will contain the return url
     */
    String DEFAULT_RETURN_URL_PARAM = "return_url";


    static io.vertx.reactivex.ext.web.handler.FormLoginHandler create(AuthProvider authProvider) {
        return io.vertx.reactivex.ext.web.handler.FormLoginHandler.newInstance(new FormLoginHandlerImpl(authProvider, DEFAULT_USERNAME_PARAM, DEFAULT_PASSWORD_PARAM, DEFAULT_RETURN_URL_PARAM, null));
    }
}
